﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DoctorScheduler.aspx.cs"
    Inherits="DoctorScheduler" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="scheduler" TagName="DoctorAdvancedForm" Src="DoctorAdvancedForm.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>تعیین زمان پزشکان</title>
    <style type="text/css">
        .RadScheduler .rsAptSubject
        {
            text-align: right;
            padding: 4px 0 1px;
            margin: 0 0 3px;
            font-size: 12px;
            font-weight: bold;
            color: #369;
            height: 17px;
            border-bottom: 1px solid #99DEFD;
            width: 100%;
        }
        
        .RadScheduler .rsAdvancedEdit .RadColorPicker label
        {
            text-align: right;
            display: block;
            padding: 0;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: center">
        <telerik:RadScriptManager runat="server" ID="ScriptManager" />
        <telerik:RadScheduler runat="server" ID="DoctorsScheduler" Width="100%" Height="100%"
            AppointmentStyleMode="Default" DataSourceID="DoctorAppointmentsEntityDataSource"
            OnAppointmentCreated="DoctorsScheduler_AppointmentCreated" OnAppointmentDataBound="DoctorsScheduler_AppointmentDataBound"
            DataKeyField="Id" DataSubjectField="Subject" DataStartField="Start" DataEndField="End"
            DataRecurrenceField="RecurrenceRule"
            DataRecurrenceParentKeyField="RecurrenceParentId" 
            OnDataBound="DoctorScheduler_DataBound"
            EditFormDateFormat="yyyy/MM/dd" EditFormTimeFormat="h:mm" FirstDayOfWeek="Saturday"
            HoursPanelTimeFormat="H:mm" LastDayOfWeek="Thursday" StartInsertingInAdvancedForm="True"
            WorkDayEndTime="23:00:00">
            <Reminders Enabled="true" />
            <AppointmentTemplate>
                <div class="rsAptSubject">
                    <%# Eval("Subject") %>
                </div>
            </AppointmentTemplate>
            <AdvancedEditTemplate>
                <scheduler:DoctorAdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
                    Start='<%# Bind("Start") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' End='<%# Bind("End") %>' DoctorID='<%# Bind("Doctor") %>'
                    RoomID='<%# Bind("Room") %>' AppointmentTypeID='<%# Bind("AppointmentType") %>'/>
            </AdvancedEditTemplate>
            <AdvancedInsertTemplate>
                <scheduler:DoctorAdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
                    Start='<%# Bind("Start") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' End='<%# Bind("End") %>' DoctorID='<%# Bind("Doctor") %>'
                    RoomID='<%# Bind("Room") %>' AppointmentTypeID='<%# Bind("AppointmentType") %>'/>
            </AdvancedInsertTemplate>
            <InlineEditTemplate>
                <scheduler:DoctorAdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
                    Start='<%# Bind("Start") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' End='<%# Bind("End") %>' DoctorID='<%# Bind("Doctor") %>'
                    RoomID='<%# Bind("Room") %>' AppointmentTypeID='<%# Bind("AppointmentType") %>'/>
            </InlineEditTemplate>
            <InlineInsertTemplate>
                <scheduler:DoctorAdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
                    Start='<%# Bind("Start") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' End='<%# Bind("End") %>' DoctorID='<%# Bind("Doctor") %>'
                    RoomID='<%# Bind("Room") %>' AppointmentTypeID='<%# Bind("AppointmentType") %>'/>
            </InlineInsertTemplate>
            <AdvancedForm DateFormat="yyyy/MM/dd" TimeFormat="h:mm" Width="100%" />
            <ResourceTypes>
             <telerik:ResourceType KeyField="Id" Name="AppointmentType" TextField="Name" ForeignKeyField="AppointmentTypeId"
                    DataSourceID="AppointmentTypesEntityDataSource"></telerik:ResourceType>
                <telerik:ResourceType KeyField="Id" Name="Room" TextField="Name" ForeignKeyField="RoomId"
                    DataSourceID="RoomsEntityDataSource"></telerik:ResourceType>
                <telerik:ResourceType KeyField="Id" Name="Doctor" TextField="Name" ForeignKeyField="DoctorId"
                    DataSourceID="DoctorsEntityDataSource"></telerik:ResourceType>
            </ResourceTypes>
            <TimelineView UserSelectable="false" />
            <TimeSlotContextMenuSettings EnableDefault="true" />
            <AppointmentContextMenuSettings EnableDefault="true" />
        </telerik:RadScheduler>
        <asp:EntityDataSource ID="DoctorAppointmentsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="DoctorAppointments" EnableDelete="True"
            EnableInsert="True" EnableUpdate="True">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="RoomsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="Rooms">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="DoctorsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities"  CommandText="SELECT it.[Id] , it.[FirstName] + ' ' + it.[LastName] as Name From DatabaseEntities.Doctors as it">
        </asp:EntityDataSource>
             <asp:EntityDataSource ID="AppointmentTypesEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="AppointmentTypes">
        </asp:EntityDataSource>
    </div>
    </form>
</body>
</html>
